(function() {/* Copyright The Closure Library Authors. SPDX-License-Identifier: Apache-2.0 */ var aa=this||self;/* Copyright 2022 Glance Networks, Inc. */ var k=["6","48","0","1818277650"].slice(0,3).join(".");Uint8Array.prototype.slice||(Uint8Array.prototype.slice=function(a,b){return new Uint8Array(this.subarray(a,b))}); ArrayBuffer.prototype.slice||(ArrayBuffer.prototype.slice=function(a,b){void 0===a&&(a=0);void 0===b&&(b=this.byteLength);a=Math.floor(a);b=Math.floor(b);0>a&&(a+=this.byteLength);0>b&&(b+=this.byteLength);a=Math.min(Math.max(0,a),this.byteLength);b=Math.min(Math.max(0,b),this.byteLength);if(0>=b-a)return new ArrayBuffer(0);var c=new ArrayBuffer(b-a),d=new Uint8Array(c);a=new Uint8Array(this,a,b-a);d.set(a);return c}); var l=navigator.userAgent.toLowerCase(),m=l.match(/(edge)[\s\/:]([\w\d\.]+)?/)||l.match(/(opera|ie|firefox|chrome|version)[\s\/:]([\w\d\.]+)?.*?(safari|version[\s\/:]([\w\d\.]+)|$)/)||l.match(/(rv):([\w\d\.]+)/)||[null,"unknown",0];"rv"===m[1]&&(m[1]="ie");function n(a){for(var b="",c=0;c",">")}function p(a){window.console&&window.console.log&&(window.GLANCE_COBROWSE?!window.GLANCE_COBROWSE.disableLogging:1)&&window.console.log(n(arguments))}function ba(a){window.console&&window.console.error&&window.console.error(n(arguments))};function r(a,...b){!window.console||!window.console[a]||window.GLANCE_COBROWSE&&window.GLANCE_COBROWSE.disableLogging||(b=b.map(c=>{if("object"===typeof c)try{c=JSON.stringify(c)}catch(d){console.error(d),c="unable to convert object to string"}return"string"===typeof c?c.replace(/[\r\n]/g," ").replace("<","<"):c}),window.console[a](...b))}function t(...a){r("log",...a)}function u(...a){r("error",...a)}function x(...a){t("PRES:",...a)};/* Copyright (c) 2022 Glance Networks, Inc. */ var y=y||{};window.GLANCE=window.GLANCE||{};window.GLANCE.VERSION="6.48.0.1818277650";window.GLANCE.PATCH="";window.GLANCE.Lib=window.GLANCE.Lib||{}; var z=function(){var a=navigator.userAgent.toLowerCase(),b=navigator.platform.toLowerCase(),c=a.match(/(edge|edg)[\s\/:]([\w\d\.]+)?/)||a.match(/(opera|ie|firefox|chrome|crios|version)[\s\/:]([\w\d\.]+)?.*?(safari|version[\s\/:]([\w\d\.]+)|$)/)||a.match(/(rv):([\w\d\.]+)/)||[null,"unknown",0];"edg"===c[1]&&(c[1]="edge");"crios"===c[1]?c[1]="chrome":"rv"===c[1]&&(c[1]="ie");a={extend:Function.prototype.extend,name:"version"==c[1]?c[3]:c[1],version:"ie"==c[1]&&document.documentMode||parseFloat("opera"== c[1]&&c[4]?c[4]:c[2]),v:{name:a.match(/ip(?:ad|od|hone)/)||b.match(/mac/)&&0C(c,b));if(null!==a&&"object"===typeof a){const c={};Object.entries(a).forEach(([d,e])=>c[d]=C(e,b));return c}return a} if(void 0===D)var D=function(a){return E.g?(Array.prototype.toJSON&&(a=C(a,E.g.window)),E.g.window.JSON.stringify(a)):JSON.stringify(a)};C=function(a,b){if(Array.isArray(a))return(new b.Array(...a)).map(c=>C(c,b));if(null!==a&&"object"===typeof a){const c={};Object.entries(a).forEach(([d,e])=>c[d]=C(e,b));return c}return a}; function ca(a){a.J=0;a.K=0;a.V=new A;a.U=new A;a.onclose=function(b){a.V.clear();a.U.clear();a.fa&&a.fa(b)};a.onmessage=function(b){b=JSON.parse(b.data);a.T&&a.T(b);a.ping()};a.B=function(b){b=D(b);a.readyState!==WebSocket.OPEN?u(`Tried to send message on closed websocket: ${b}`):a.send(b)};a.da=function(b){return b&&b.code||0};a.ea=function(b){return b&&b.reason||""};a.la=function(b,c){this.J=b;this.K=c;this.ping()};a.ping=function(){0a.B({mtype:"Ping"}));0a.onerror(new Event("WS_PING_TIMEOUT")))}}function da(a){a=new WebSocket(a);ca(a);return a}function ea(a,b){B("setTimeout",function(){ea(a,b)},100)}function F(a,b){if(void 0!==a){var c=c||Object.keys(a);c.forEach(function(d){void 0!==a[d]&&(b[d]=a[d])})}} function fa(a){var b=a.func.split(".");if(2>b.length)u("ERR_BADINVOKE:");else if("GLANCE"===b[0]||"GLANCE_COBROWSE"===b[0]&&"Custom"===b[1]){for(var c=window[b[0]],d=1;dc[d]!==a.g[d]).length?a.i=c.directserver:x("Ignoring glance_presence entry for different webserver, group, or visitor",c.ws,c.groupid,c.visitorid));x("direct server from local storage:",a.i)}var O=1;N.prototype.L=function(){}; function ta(a,b,c,d,e){if(b&&!a.i)p("ERR_NODIRECTSERVER");else{var h=(e||"https")+"://"+(b?a.i:a.g.presenceserver)+"/"+c;d&&(h+="?",["groupid","visitorid"].forEach(function(f){h+=f+"="+a.g[f]+"&"}),h+=`&ver=${k}`);return h}}N.prototype.N=function(a){P(this,"findvisitor","GET",a)}; function Q(a){p("connecting to "+a.i);a.h&&a.h.close();a.h=da(ta(a,!0,"visitorws",!1,"wss"));a.h.W=a.i;a.h.onopen=function(){x("sock onopen, sending connect");a.h.B({type:"connect",authorization:void 0,groupid:a.g.groupid,visitorid:a.g.visitorid,guesttoken:a.g.guesttoken,version:k});a.u=0;x("sending message queue");a.G.forEach(function(b){a.h.B(b)});a.G=[];a.j=3};a.h.T=function(b){p("received:"+D(b));if(a.h){var c=h=>{a.S.clear();if(!a.C&&(a.C=!0,a.onvisitorconn))a.onvisitorconn(h)},d=b.mtype||b.type, e=b.data;switch(d){case "connected":if(a.g.nokeepalive)break;x("Keepalive interval: "+b.keepalive);a.D||(a.D=window.setInterval(function(){a.h.B({type:"k"})},1E3*b.keepalive));if(a.onconnected)a.onconnected(e);break;case "invoke":"visitor"===a.Y&&fa(e);break;case "redirect":case "serverclose":e||(e=b);a["on"+d](e);break;case "visitorsock":e.connected?c(e):!e.connected&&a.C&&a.S.set(5E3,()=>{a.C=!1;if(a.onvisitorconn)a.onvisitorconn(e)});break;case "visitorconn":e.connected&&c(e);break;default:if(a["on"+ d])a["on"+d](e)}}else x("Ignoring message received after socket close")};a.h.onclose=function(b){a.h===this&&(p(`presence connection closed ${this.da(b)} ${this.ea(b)}`),ua(a),a.s())};a.h.onerror=function(b){a.h===this&&(x("socket error"),a.h.onclose(b))}} function P(a,b,c,d){function e(q){var w=q&&(q.directserver||q.direct);w&&(f.i=w,q.httpsport&&(f.i+=":"+q.httpsport),f.L());f.h&&f.i!=f.h.W&&(x("switching connection from "+f.h.W+" to "+f.i),Q(f));if(d&&d.onsuccess)d.onsuccess(q)}function h(q,w,ma){p(`Presence request: ${b} failed reason: ${w} http status: ${ma||0}`);503===ma&&(ba("Presence service unavailable"),f.R=!0,w="serviceunavailable");if(d.onfail)d.onfail(w);else R(f,{error:"connfail",detail:w})}if(!a.R){var f=a,v=new G;v.i=void 0;v.method= c;p(b,JSON.stringify(d));va(a,function(){f.g.presenceserver&&I(v,ta(f,!1,b,!0),d.data?d.data:{},!0,!1,e,h)})}} function va(a,b){if(a.g.presenceserver)b();else{var c=new J("glance_visitor_settings_"+a.g.groupid+"_"+a.g.site),d=ka(c);if(d)a.g.presenceserver=d.presenceserver,a.g.isLoadBalanced=d.presencesettings.isPresenceLoadBalanced,a.g.isLoadBalanced&&(a.i=a.g.presenceserver),a.g.presenceserver||p("PRES_DISABLED (from cache)"),b();else{d=new G;var e="https://"+a.g.ws+"/services/authorizationservice/GetVisitorSettings3?groupid="+a.g.groupid+"&site="+a.g.site+"&service=presence";d.method="GET";I(d,e,null,!0, !1,h=>{a.g.presenceserver=h.presenceUrl;h.isPresenceLoadBalanced&&(a.g.isLoadBalanced=h.isPresenceLoadBalanced,a.i=h.presenceUrl);x("presence service: "+a.g.presenceserver);a.g.presenceserver||p("PRES_DISABLED");var f={};f.presenceserver=a.g.presenceserver;f.presencesettings=h;ja(c,f);na(c,1440);return b()},(h,f)=>{p("PRES_UNAVAILABLE "+f);b()})}}}function S(a){x("closewebsocket");a.h&&a.h.close();ua(a)} function ua(a){a.D&&(window.clearInterval(a.D),delete a.D);a.j=O;a.g.isLoadBalanced||(delete a.h,delete a.i)}function T(a,b){p("sending",b.type,a.j);3===a.j?(x("sending message: "+JSON.stringify(b)),a.h.B(b)):(x("queuing message: "+JSON.stringify(b)),a.G.push(b),a.connect())}N.prototype.ca=function(){return this.g.visitorid};N.prototype.getVisitorId=N.prototype.ca;N.prototype.X=function(a){let b=3===this.j;b&&this.disconnect();this.g.visitorid=a;(b||"api"!==this.g.presence)&&this.connect()}; N.prototype.setVisitorId=N.prototype.X; N.prototype.connect=function(){if(!this.R)if(this.g.visitorid)if(this.j!==O)x("connect() called when already connecting or connected");else{this.j=2;x("connect");var a=this;this.onscaledown=function(){a.disconnect();a.connect()};this.onredirect=function(b){x("Connected to wrong instance:",JSON.stringify(b),"current direct server:",this.i);this.m&&b.direct!==this.i&&(K(this.m),this.m=new J("glance_presence"),this.disconnect(),this.s())};this.onserverclose=function(){a.disconnect();if(a.onclose)a.onclose()}; va(this,()=>{p("visitor settings loaded");this.i?Q(this):this.N({onsuccess:function(){p("found visitor, connect");Q(a)},onfail:function(b){a.j=O;R(a,{error:"connfail",detail:b})}})})}else p("CONN_NOVISITORID")};N.prototype.connect=N.prototype.connect;N.prototype.disconnect=function(){S(this);this.m&&K(this.m)};N.prototype.disconnect=N.prototype.disconnect; N.prototype.s=function(){x(`delayed reconnect. count: ${this.u||0} connstate: ${this.j}`);this.M||(this.u=this.u||0,this.u++,this.M=window.setTimeout(()=>{delete this.M;this.connect()},3>=this.u?5E3:6E4))};N.prototype.I=function(){return 3===this.j};N.prototype.isconnected=N.prototype.I;function R(a,b){p("Error: ",JSON.stringify(b));a.O&&a.O(b);if(a.onerror)a.onerror(b)}N.prototype.aa=function(a,b){T(this,{type:a,data:b})};N.prototype.fire=N.prototype.aa;function U(a){sa(this,a);this.Y="visitor";this.o=new L;this.H=!1;var b=this;B("addEventListener","focus",function(){x("presence visitor got focus event");b.F=!1;b.P&&b.A()},void 0);oa(this.o,function(){if(!b.H&&(x("visibility:",M(b.o)?"hidden":"visible"),(b.P||b.I())&&!b.F)){var c={type:"visibility"};c.data={visibility:M(b.o)?"hidden":"visible"};T(b,c);M(b.o)&&S(b)}});U.instance=this}var wa=U,V=["GLANCE","Presence","Visitor"],W=aa;V[0]in W||"undefined"==typeof W.execScript||W.execScript("var "+V[0]); for(var X;V.length&&(X=V.shift());)V.length||void 0===wa?W[X]&&W[X]!==Object.prototype[X]?W=W[X]:W=W[X]={}:W[X]=wa;U.prototype=new N;U.prototype.L=function(){x("caching direct server:",this.i);var a={};a.directserver=this.i;a.groupid=this.g.groupid;a.visitorid=this.g.visitorid;a.ws=this.g.ws;ja(this.m,a);na(this.m,20)};U.prototype.s=function(){M(this.o)||N.prototype.s.bind(this)()}; U.prototype.A=function(a){x("presence");if(this.g.visitorid){this.l=this.l||{};for(var b in this.g)0===b.indexOf("user-")&&(this.l[b.substring(5)]=this.g[b]);this.l.url=window.location.href;this.l.browser=z.name;this.l.browserver=z.version;this.l.platform=z.v.name;(a=a&&a.data)&&F(a,this.l);this.F||(a={type:"presence"},a.data=this.l,T(this,a),this.P=!0);this.O=function(c){"connfail"===c.error&&this.s()}}else p("PRES_NOVISITORID")};U.prototype.presence=U.prototype.A; U.prototype.Z=function(a){var b=this;this.H=!0;P(this,"uniquevisitor","GET",{onsuccess:function(c){p("got unique visitor id",c.visitorid);b.g.visitorid=c.visitorid;b.g.guesttoken=c.guesttoken;b.g.timeout=c.timeout||300;if(b.onuniqueid)b.onuniqueid(c.uniqueid,b.g.timeout);b.connect();a&&a.data&&b.A({data:a.data})},onfail:function(c){R(b,{error:"connfail",detail:c})}})};U.prototype.connectUnique=U.prototype.Z; U.prototype.$=function(){this.H?this.I()?(this.disconnect(),this.A()):R(this,{error:"connfail",detail:"extend"}):console.error("ERR_EXTEND_UNIQUE")};U.prototype.extendUnique=U.prototype.$;U.setVisitorId=function(a){U.instance&&U.instance.X(a)};U.prototype.N=function(a){this.g.isLoadBalanced||(a.data={},P(this,"presence","POST",a))};U.prototype.onblur=function(){p("BLURRED");this.F=!0;S(this)};var xa=!1;function Y(){if(!xa){xa=!0;var a=ra();a.presence&&"api"!==a.presence&&(new U).A()}}var Z=new L; Z.i.addEventListener&&(document.readyState.match(/complete/)?Y():(Z.i.addEventListener("load",Y),Z.g.addEventListener("DOMContentLoaded",Y,!1)));}).call(window); //# sourceMappingURL=map.js.map